<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
      .active {
          color: gold;
      }

      li {
          color: aqua;
      }
  </style>
</head>
<body>
  <div id="app">
    <com-a :lists='list'></com-a>
  </div>

  <template id="tmp1">
      <div>
          <h1>接受父组件传递过来的数据</h1>
          <ul>
              <li v-for='(item,index) in lists' :key='index' :class='index % 2 == 0 ? "active" : ""'>
                  {{item}}
              </li>
          </ul>
      </div>
  </template>

  <script src="./vue.js"></script>
  <script>
      Vue.component("comA",{
          props:['lists'],
          template:"#tmp1"
      })

    var vm = new Vue({
      el:'#app',
      data:{
          list:['麻辣香锅','韭菜鸡蛋','剥皮鱼','小炒黄牛肉']
      },
     });
  </script>
</body>
</html>
